/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * @author Abahe
 */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import com.nokia.maps.map.MapCanvas;
import com.nokia.maps.common.*;



/**
 * @author juksilve
 */
public class HelloMapMidlet extends MIDlet implements CommandListener{

    private final Command exitCommand;

    public HelloMapMidlet()
    {
        exitCommand = new Command("Exit", Command.EXIT, 1);
    }

    public void startApp() {
        // Get your own app_id and token by registering at
	// https://api.developer.nokia.com/ovi-api/ui/registration
//	ApplicationContext.getInstance().setAppID("My-Id");
//	ApplicationContext.getInstance().setToken("MyToken");

	Display display = Display.getDisplay(this);
        MapCanvas mapCanvas = new MapCanvas(display) {

            public void onMapUpdateError(String string, Throwable thrwbl, boolean bln) {
                // implement update error handler in here
            }

            public void onMapContentComplete() {
                // add anything needed to be handled when map has been updated.
            }
        };
        display.setCurrent(mapCanvas);

        mapCanvas.setTitle("Hello Map");
        mapCanvas.addCommand(exitCommand);
        mapCanvas.setCommandListener(this);
    }


    public void commandAction(Command command, Displayable displayable)
    {
        if (command == exitCommand){
            notifyDestroyed();
        }
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }
}
